A photoelectric sensor known in the art is described in Patent Literature 1. The photosensor includes an emitter lead connected to a light emitter, a receiver lead connected to a light receiver, a circuit-encapsulating portion encapsulating an integrated circuit, and connecting terminals connected to external terminals. In this photosensor, the emitter lead and the receiver lead protrude from the circuit-encapsulating portion in a direction opposite to the direction in which the connecting terminals extend.